cmake_minimum_required(VERSION 3.16)

project(test_window)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
add_compile_options(-Wno-deprecated-declarations)
add_compile_options(-Wno-unknown-warning-option)
add_compile_options(-Wno-extern-c-compat)
add_compile_options(-Wno-format-truncation)
 

file(GLOB_RECURSE HEADERS  include/*.hpp include/*.h)
file(GLOB SRCS
    src/*.cpp
    src/*.mm
    )
 
source_group("Header Files" FILES ${HEADERS})
source_group("Source Files" FILES ${SRCS})

find_package(PkgConfig REQUIRED)
pkg_search_module(CAIRO REQUIRED cairo)
if (NOT CAIRO_FOUND)
    message(FATAL_ERROR "Cairo not found")
endif()

include_directories(${CAIRO_INCLUDE_DIRS})
link_directories(${CAIRO_LIBRARY_DIRS} )

find_package(Freetype REQUIRED)
find_package(PNG REQUIRED)
find_package(Fontconfig REQUIRED)
find_package(Iconv REQUIRED)



find_library(COCOA_LIBRARY Cocoa)
find_library(QUARTZ_LIBRARY QuartzCore)
find_library(IOKit_LIBRARY IOKit)
find_library(Carbon_LIBRARY Carbon)
set(LIBS ${CAIRO_LIBRARIES}  
    Freetype::Freetype 
    PNG::PNG
    Fontconfig::Fontconfig  
    Iconv::Iconv
    ${COCOA_LIBRARY}
    ${QUARTZ_LIBRARY}
    ${IOKit_LIBRARY}
    ${Carbon_LIBRARY}
)
add_executable(test_window MACOSX_BUNDLE ${SRCS} ${HEADERS})
target_compile_options(test_window PRIVATE "-fobjc-arc")
target_link_libraries(test_window ${LIBS})



